package pe.edu.upc.karaoke.negocio;

import java.util.List;

import pe.edu.upc.karaoke.dao.LocalDAO;
import pe.edu.upc.karaoke.dao.ReservaDAO;
import pe.edu.upc.karaoke.excepcion.DAOExcepcion;
import pe.edu.upc.karaoke.modelo.Local;
import pe.edu.upc.karaoke.modelo.Reserva;


public class ReservaCore {
	
	public Reserva obtener(int idReserva) throws DAOExcepcion {
		Reserva reserva = null;
		try{
			ReservaDAO dao = new ReservaDAO();
			reserva = dao.obtener(idReserva);
		}
		catch (Exception e) {
            e.printStackTrace();
        }
        return reserva;
				
	}
	
	public List<Reserva> listarReservas(String nombre) throws DAOExcepcion {
	    
		List<Reserva> list = null;
		try{
			ReservaDAO dao = new ReservaDAO();
		    list = dao.listarReserva(nombre);
		}
		catch (Exception e) {
            e.printStackTrace();
        }
        return list;
		
	}
	
	public Reserva insertar(Reserva reserva) throws DAOExcepcion {
		
		try{
			ReservaDAO dao = new ReservaDAO();
			reserva = dao.insertar(reserva);
		}
		catch (Exception e) {
            e.printStackTrace();
        }
        return reserva;
        
	}

	
	public String eliminar(int idReserva) throws DAOExcepcion {
		
		String vReturn = "NO_OK";
		try{
			ReservaDAO dao = new ReservaDAO();
			vReturn = dao.eliminar(idReserva);
		}
		catch (Exception e) {
            e.printStackTrace();
        }
        return vReturn;
		
	}

	
	public Reserva actualizar(Reserva reserva) throws DAOExcepcion {
		
		try{
			ReservaDAO dao = new ReservaDAO();
			reserva = dao.actualizar(reserva);
		}
		catch (Exception e) {
            e.printStackTrace();
        }
        return reserva;
        
	}

}
